package game.Actors;
import game.Config.Config;
import org.newdawn.slick.Image;
import org.newdawn.slick.geom.Vector2f;
/**
 * This class represents an ice bullet in the game.
 * The ice bullet extends fadingbullet, and will thus disappear after traveling a given distance.
 * When the ice bullet collides with an enemy it will create a new ice effect on the enemy.
 * @author Sebastian Isheden and Victor Beer.
 *
 */
public class IceBullet extends FadingBullet{
	private float freezeTime;
	private float freezePercent;
	/**
	 * Creates a new IceBullet based on given parameters.
	 * @param image The image of the bullet.
	 * @param position The position of the bullet.
	 * @param speed The speed of the bullet.
	 * @param direction The direction of the bullet.
	 * @param damage The damage of the bullet.
	 * @param fadeDistance The distance this bullet will travel before disappearing. 
	 * @param freezeTime The time this bullet will freeze an enemy when it collides.
	 * @param freezePercent The amount this bullet will slow an enemy when it collides.
	 */
	public IceBullet(Image image, Vector2f position, float speed,Vector2f direction, float damage,float fadeDistance,float freezeTime,float freezePercent) {
		super(image, position, speed, direction, damage,fadeDistance);
		this.freezeTime = freezeTime;
		this.freezePercent = freezePercent;
	}
	@Override
	protected void explode(Enemy enemy){
		if(!enemy.isDead){
			new IceEffect(Config.iceEffectImage,enemy.position.copy(),freezeTime,enemy,freezePercent);
		}
		this.isDead = true;
	}
}
